import request from "@/utils/request";

// 查询表格列表
export function listRole(query: any) {
    return request({
        url: "/tableConfig/menuTable/list",
        method: "get",
        params: query,
    });
}

// 查询表格列表
export function pageRole(query: any) {
    return request({
        url: "/tableConfig/menuTable/page",
        method: "post",
        data: query,
    });
}

// 查询表格详细
export function getRole(roleId: any) {
    return request({
        url: "/tableConfig/menuTable/" + roleId,
        method: "get",
    });
}

// 新增表格
export function addRole(data: any) {
    return request({
        url: "/tableConfig/menuTable",
        method: "post",
        data: data,
    });
}

// 修改表格
export function updateRole(data: any) {
    return request({
        url: "/tableConfig/menuTable",
        method: "put",
        data: data,
    });
}

// 删除表格
export function delRole(roleId: any) {
    return request({
        url: "/tableConfig/menuTable/" + roleId,
        method: "delete",
    });
}

// 查询db数据库列表
export function listDbTable(query: any) {
    return request({
        url: "/tableConfig/menuTable/db/list",
        method: "post",
        data: query,
    });
}

// 导入表
export function importTable(params: any) {
    return request({
        url: "/tableConfig/menuTable/importTable",
        method: "post",
        data: params,
    });
}

// 同步数据库
export function synchDb(tableId: any) {
    return request({
        url: "/tableConfig/menuTable/synchDb/" + tableId,
        method: "get",
    });
}

// 获取表格配置
export function getTableConfig(tableId: any) {
    return request({
        url: "/tableConfig/menuTable/MenuTableConfig/" + tableId,
        method: "get",
    });
}
// 保存表格配置
export function saveTableConfig(data: any) {
    return request({
        url: "/tableConfig/menuTable/MenuTableConfig",
        method: "post",
        data: data,
    });
}
// 表单筛选
export function formFilter(data: any) {
    return request({
        url: "/tableConfig/menuTable/generate_from_filter",
        method: "post",
        data: data,
    });
}
// 删除表单筛选
export function deleteFilter(data: any) {
    return request({
        url: "/tableConfig/menuTable/delete_from_filter",
        method: "post",
        data: data,
    });
}
//设置用户列宽
export function userColumnWidth(data: any) {
    return request({
        url: "/tableConfig/menuTable/userColumnWidth",
        method: "post",
        data: data,
    });
}
//设置用户列顺序
export function userColumnOrder(data: any) {
    return request({
        url: "/tableConfig/menuTable/userColumnOrder",
        method: "post",
        data: data,
    });
}
